package com.ruoyi.business.service.impl;

import com.ruoyi.bizsys.domain.ProductInfo;
import com.ruoyi.business.mapper.BProductMapper;
import com.ruoyi.business.service.IBProductService;

import java.util.ArrayList;
import java.util.List;

import com.ruoyi.common.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author:
 * @Date: 2021/3/1 10:43 上午
 */
@Service
public class BProductServiceImpl implements IBProductService {
	
	@Autowired
	BProductMapper productMapper;
	
	public List<ProductInfo> getActiveProductList(String creditRating){
		List<ProductInfo> objects = new ArrayList<>();
		if (Func.isNotEmpty(creditRating)){
			objects = productMapper.getActiveProductList(creditRating);
		}
		//信用评级获取不到产品时 获取默认产品
		if (objects.size() == 0){
			objects = productMapper.getActiveProductList(null);
		}
		return objects;
	}

	@Override
	public List<ProductInfo> getActiveDefaultProductList() {
		return productMapper.getActiveDefaultProductList();
	}

	@Override
	public ProductInfo getAppGpReviewProduct() {
		return productMapper.getAppGpReviewProduct();
	}

	@Override
	public List<ProductInfo> selectProductListByTime(Integer intervalTime) {
		return productMapper.selectProductListByTime(intervalTime);
	}
}
